Function Reference

ObjName

Returns the name or interface description of an Object

ObjName ( $Objectvariable [,Flag] )

 

Parameters

$Objectvariable A variable containing an Object whose name you want to retrieve
Flag 1 = Name of the dispatch interface being used (default)
2 = Description of the (document) Object
3 = The ProgID of the Object
4 = The DLL file from with the Object was created (if supported)
5 = Filename and position of the toolbox icon (if supported)

 

Return Value

Success: Returns a string representing the name
Failure: Sets @error and Returns ""

 

Remarks

Not all Objects support flags 2 to 5. Always test for @error in these cases.

 

Related

IsObj, ObjGet, ObjCreate

 

Example


$oInternet = ObjCreate("InternetExplorer.Application")
$oInternet.Navigate( "http://www.google.com" ) ; Opening a web page that contains a form
sleep(4000)                 ; Give the page time to load

$oDoc = $oInternet.document ; Example object to test
$oForm = $oDoc.forms(0)     ; Example object to test

msgbox(0,"","Interface name of $oInternet is: " & ObjName($oInternet) & @CRLF & _
            "Object name of $oInternet is:    " & ObjName($oInternet,2) & @CRLF & _
            "Interface name of $oDoc is:      " & ObjName($oDoc) & @CRLF & _
            "Object name of $oDoc is:         " & ObjName($oDoc,2) & @CRLF & _
            "Interface name of $oForm is:     " & ObjName($oForm) & @CRLF & _
            "Object name of $oForm is:        " & ObjName($oForm,2))